<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "goods".
 *
 * @property int $id
 * @property string $name
 * @property string $price
 * @property int $stock
 * @property int $startime
 * @property int $endtime
 * @property string $path
 * @property int $type
 * @property int $brand
 */
class Goods extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'goods';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['price'], 'number'],
            [['stock', 'startime', 'endtime', 'type', 'brand'], 'integer'],
            [['name', 'path'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'price' => 'Price',
            'stock' => 'Stock',
            'startime' => 'Startime',
            'endtime' => 'Endtime',
            'path' => 'Path',
            'type' => 'Type',
            'brand' => 'Brand',
        ];
    }

    public function show(){
    $customers = Goods::find()
    ->asArray()
    ->all();
    return $customers;
    }

}
